table.FETCH_FIRST Function

Syntax

Found_Flag as N = Fetch_First([fetch level])

Arguments

Found_Flag

0 if a record was found. A negative number if no record was found.

level

Optional. Used when fetching through the records of a set. The outline level determines the depth of the fetch, so that tables at lower levels in the set can be excluded from the Fetch operation.

Description

Fetch the first record in the table/set. returns TRUE if record found.

Discussion

The <TBL>.FETCH_FIRST() method retrieves the first record in the table or set referenced by <TBL>. The first record is determined by the active range, index, or query list. If there are no records in the current range or query, and therefore, no first record is found, a non-zero numeric value is returned. You use the optional Level_Number parameter when fetching through the records of a set. The outline level determines the depth of the fetch, so that tables at lower levels in the set can be excluded from the Fetch operation. This is useful for operations that relate to only parent records in a set. For more information, see Fetching_Only_Parent_Records_With_Fetch_Outlining.

Example

This script will open a table and fetch the first record.

dim tbl as P
tbl = table.open("c:\a5\a_sports\customer.dbf")
tbl.fetch_first()

This script which is attached to a button on a form will display the first record in the form.

dim tbl as P
tbl = table.current()
tbl.fetch_first()
parent.resynch()

This script also displays the first record on the form, but it uses a form method instead

parent.fetch_first()

See Also